using Avalonia.Controls;
using Avalonia.Interactivity;
using System.Diagnostics;
using System;
using Avalonia;

namespace DesktopApp.Views
{
    public partial class AboutWindow : Window
    {
        public AboutWindow()
        {
            InitializeComponent();
#if DEBUG
            this.AttachDevTools();
#endif
        }

        // Generic link button click handler
        private void LinkButton_Click(object? sender, RoutedEventArgs e)
        {
            if (sender is Button button && button.Tag is string url && !string.IsNullOrEmpty(url))
            {
                try
                {
                    // Use ShellExecute for cross-platform compatibility
                    Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
                    Debug.WriteLine($"Opened URL: {url}");
                }
                catch (Exception ex)
                {
                    // Log error or show message to user
                    Debug.WriteLine($"Error opening URL '{url}': {ex.Message}");
                }
            }
             else
            {
                 Debug.WriteLine("LinkButton_Click: Sender is not a Button or Tag is not a valid URL string.");
            }
        }

        private void CloseButton_Click(object? sender, RoutedEventArgs e)
        {
            Close();
        }
    }
} 